﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;

namespace Himp.Outpatient
{
    /// <summary>
    /// 支付记录
    /// </summary>
    public class OtpPayRec : AuditedAggregateRoot<Guid>, IMultiTenant
    {
        public Guid OtpPayWayId { get; set; }

        /// <summary>
        /// 支付方式代码
        /// </summary>
        public string PayWayCode { get; set; }

        /// <summary>
        /// 支付方式
        /// </summary>
        public OtpPayWay OtpPayWay { get; set; }

        /// <summary>
        /// 交易流水号
        /// </summary>
        public string TraceSn { get; set; }

        /// <summary>
        /// 金额
        /// </summary>
        public decimal Amt { get; set; }

        /// <summary>
        /// 支付时间
        /// </summary>
        public DateTime? PayTime { get; set; }

        /// <summary>
        /// 退款时间
        /// </summary>
        public DateTime? RefdTime { get; set; }

        /// <summary>
        /// 退款流水号
        /// </summary>
        public string? RefdSn { get; set; }

        /// <summary>
        /// 支付记录状态
        /// </summary>
        public EnumPayRecStas PayRecStas { get; set; }

        /// <summary>
        /// 退款操作员编码
        /// </summary>
        public Guid? RefdOpterId { get; set; }

        /// <summary>
        /// 订单信息
        /// </summary>
        public Guid OtpOrdRecId { get; set; }

        /// <summary>
        /// 订单信息
        /// </summary>
        public OtpOrdRec OtpOrdRec { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public Guid? TenantId { get; set; }

        public OtpPayRec(Guid otpPayWayId,  decimal amt, Guid otpOrdRecId, string payWayCode)
        {
            OtpPayWayId = otpPayWayId;
            Amt = amt;
            PayTime = DateTime.Now;
            OtpOrdRecId = otpOrdRecId;
            PayRecStas = EnumPayRecStas.已支付;
            TraceSn = Guid.NewGuid().ToString();
            PayWayCode = payWayCode;

        }

        public OtpPayRec()
        { 
            
        }
    }
}
